package com.victualler.core.common.utils;

import java.util.ArrayList;
import java.util.List;

import com.victualler.core.common.dto.QueryDto;
import com.victualler.core.common.enums.QueryConditionEnum;

public class QueryObject{
	private List<QueryDto>  results ;
	public QueryObject(){
		results  = new ArrayList<>();
	}
	
    public  QueryObject  linkEQ(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.EQ.getKey(), value));
    	return this;
    }
    
    public  QueryObject  linkLess(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.Less.getKey(), value));
    	return this;
    }
    
    public  QueryObject  linkLessAndEQ(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.LessAndEQ.getKey(), value));
    	return this;
    }
    
    
    public  QueryObject  linkGreater(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.Greater.getKey(), value));
    	return this;
    }
    
    
    public  QueryObject  linkGreaterAndEQ(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.GreaterAndEQ.getKey(), value));
    	return this;
    }
    
    
    public  QueryObject  linkLike(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.Like.getKey(), value));
    	return this;
    }
    
    public  QueryObject  linkEndLike(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.endLike.getKey(), value));
    	return this;
    }
    
    
    public  QueryObject  linkStartLike(String fieldName,String value){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.StartLike.getKey(), value));
    	return this;
    }
    
    public  QueryObject orderByDesc(String fieldName){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.DESC.getKey(), null));
    	return this;
    }
    public  QueryObject orderByAsc(String fieldName){
    	this.results.add(new QueryDto(fieldName, QueryConditionEnum.ASC.getKey(), null));
    	return this;
    }
    
    public List<QueryDto> getResult(){
		return this.results; 
    }
}
